package org.mysfit.ctp4j.infra.enums;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

/**
 * 操作系统类型枚举
 * 
 * @author long.gf
 *
 */
public enum PolyEnum {

	POLY_A("POLY_A","55s开仓 15s平仓 最新价大于等于上个FK收盘价 开多 小于FK开空",1,1,"POLY_A") ;

	private String polyNo;
	
	private String polyName;
	
	private int status;
	
	private int level;
	
	private String desc;
	
	private PolyEnum(String polyNo, String polyName, int status, int level, String desc) {
		this.polyNo = polyNo;
		this.polyName = polyName;
		this.status = status;
		this.level = level;
		this.desc = desc;
	}


	public String getPolyNo() {
		return polyNo;
	}


	public void setPolyNo(String polyNo) {
		this.polyNo = polyNo;
	}


	public String getPolyName() {
		return polyName;
	}


	public void setPolyName(String polyName) {
		this.polyName = polyName;
	}


	public int getStatus() {
		return status;
	}


	public void setStatus(int status) {
		this.status = status;
	}


	public String getDesc() {
		return desc;
	}


	public void setDesc(String desc) {
		this.desc = desc;
	}


	public int getLevel() {
		return level;
	}


	public void setLevel(int level) {
		this.level = level;
	}
	
	public static List<PolyEnum> getEffectuveList() {
		List<PolyEnum> polyList = new ArrayList<PolyEnum>();
		PolyEnum[] polys = PolyEnum.values();
		Arrays.sort(polys, new Comparator<PolyEnum>() {
			@Override
			public int compare(PolyEnum o1, PolyEnum o2) {
				return o2.getLevel() - o1.getLevel();
			}
		});
		for (PolyEnum en : polys) {
			if(en.getStatus() == 1) {
				polyList.add(en);
			}
		}
		return polyList;
	}
	
}
